﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Remoting;
using System.Text;
using NUnit.Framework;

namespace Imgur.Net.Test
{
    [TestFixture]
    public class ImageInfoTests
    {
        [Test]
        public void Constructor1Test()
        {
            string id = "id1234";
            string title = "Test Title";
            string description = "The Descrition";
            DateTime timestamp = DateTime.Now;
            int width = 200;
            int height = 400;
            
            var instance = new ImageInfo(id, title, description, timestamp, width, height);

            Assert.AreEqual(id, instance.Id);
            Assert.AreEqual(title, instance.Title);
            Assert.AreEqual(description, instance.Description);
            Assert.AreEqual(timestamp, instance.TimeStamp);
            Assert.AreEqual(width, instance.Width);
            Assert.AreEqual(height, instance.Height);
        }

        [Test]
        public void Constructor2Test()
        {
            string id = "id1234";
            string title = "Test Title";
            string description = "The Descrition";
            DateTime timestamp = DateTime.Now;
            string mimeType = "image/jpeg";
            int width = 200;
            int height = 400;
            long filesize = 319592903L;
            int views = 20;
            long bandwidth = 23985989231934L;
            string deletehash = "ageskljer";

            var instance = new ImageInfo(id, title, description, timestamp, mimeType, width, height, filesize, views,
                bandwidth, deletehash);

            Assert.AreEqual(id, instance.Id);
            Assert.AreEqual(title, instance.Title);
            Assert.AreEqual(description, instance.Description);
            Assert.AreEqual(timestamp, instance.TimeStamp);
            Assert.AreEqual(mimeType, instance.MimeType);
            Assert.AreEqual(width, instance.Width);
            Assert.AreEqual(height, instance.Height);
            Assert.AreEqual(filesize, instance.FileSize);
            Assert.AreEqual(views, instance.Views);
            Assert.AreEqual(bandwidth, instance.Bandwidth);
            Assert.AreEqual(deletehash, instance.DeleteHash);
        }

        [Test]
        public void Constructor3Test()
        {
            string id = "id1234";
            string title = "Test Title";
            string description = "The Descrition";
            DateTime timestamp = DateTime.Now;
            string mimeType = "image/jpeg";
            bool isAnimated = false;
            int width = 200;
            int height = 400;
            long filesize = 319592903L;
            int views = 20;
            long bandwidth = 23985989231934L;
            string deletehash = "ageskljer";
            string section = "imgsection";
            string link = "http://imgur.com/abcdefg";
            bool isfavorite = true;
            bool isnsfw = false;
            string accountUrl = "http://imgur.com/users/12345";

            var instance = new ImageInfo(id, title, description, timestamp, mimeType, isAnimated, width, height,
                filesize, views, bandwidth, deletehash, section, link, isfavorite, isnsfw, accountUrl);

            Assert.AreEqual(id, instance.Id);
            Assert.AreEqual(title, instance.Title);
            Assert.AreEqual(description, instance.Description);
            Assert.AreEqual(timestamp, instance.TimeStamp);
            Assert.AreEqual(mimeType, instance.MimeType);
            
            Assert.IsNotNull(instance.IsAnimated);
            Assert.IsTrue(instance.IsAnimated.HasValue);
            Assert.IsFalse(instance.IsAnimated.Value);
            
            Assert.AreEqual(width, instance.Width);
            Assert.AreEqual(height, instance.Height);
            Assert.AreEqual(filesize, instance.FileSize);
            Assert.AreEqual(views, instance.Views);
            Assert.AreEqual(bandwidth, instance.Bandwidth);
            Assert.AreEqual(deletehash, instance.DeleteHash);
            Assert.AreEqual(section, instance.Section);
            Assert.AreEqual(link, instance.Link);

            Assert.IsNotNull(instance.IsFavorite);
            Assert.IsTrue(instance.IsFavorite.HasValue);
            Assert.IsTrue(instance.IsFavorite.Value);

            Assert.IsNotNull(instance.IsNSFW);
            Assert.IsTrue(instance.IsNSFW.HasValue);
            Assert.IsFalse(instance.IsNSFW.Value);

            Assert.AreEqual(accountUrl, instance.AccountUrl);
        }
    }
}
